﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace Maticsoft.Web
{
    public partial class ListC : System.Web.UI.Page
    {
        Maticsoft.BLL.newsInfo nm = new BLL.newsInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        private void Bind()
        {
            int count = 0;

            List<Maticsoft.Model.newsInfo> nl = nm.GetListByPage("国家法律法规", this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, out count);

            this.AspNetPager1.RecordCount = count;

            StringBuilder str = new StringBuilder();

            for (int i = 0; i < nl.Count; i++)
            {
                StrAppend(nl, str, i);
            }

            this.lti_news.Text = str.ToString();
        }

        private static void StrAppend(List<Maticsoft.Model.newsInfo> nl_t1, StringBuilder str, int i)
        {
            str.Append(" <div class='item'> ");
            str.Append("  <a href='read.aspx?a=");
            str.Append(nl_t1[i].newsId);
            str.Append(" ' title='");
            str.Append(nl_t1[i].newsTitle);
            str.Append(" '>  ");
            str.Append(nl_t1[i].newsTitle);
            str.Append("</a></div>");


        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            Bind();
        }
    }
}